#ifndef __PMEM_H__
#define __PMEM_H__

#include "common.h"
#include "mem/vmem.h"
// 物理页节点
typedef struct page_node {
    struct page_node* next;
    uint32 refNum; // 引用计数
} page_node_t;

// 来自kernel.ld
extern char KERNEL_DATA[];
extern char ALLOC_BEGIN[];
extern char ALLOC_END[];

void  pmem_init(void);
void* pmem_alloc(bool in_kernel);
void  pmem_free(uint64 page, bool in_kernel);
int   cow_alloc(pgtbl_t pagetable, uint64 va);

#endif